// pages/other.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    mixedList: [{
        id: 0,
        title: "指示灯说明",
        image: "https://img.99666666.xyz/yugang/images/introduce/指示灯说明.jpg",
        loaded: false
      }, {
        id: 1,
        title: "IOS搜索设备",
        image: "https://img.99666666.xyz/yugang/images/introduce/IOS%E6%90%9C%E7%B4%A2%E8%AE%BE%E5%A4%87%E6%8C%87%E5%BC%95.jpg",
        loaded: false
      }, {
        id: 2,
        title: "添加设备",
        image: "https://img.99666666.xyz/yugang/images/introduce/添加设备.jpg",
        loaded: false
      }, {
        id: 3,
        title: "首页",
        image: "https://img.99666666.xyz/yugang/images/introduce/首页.jpg",
        loaded: false
      },
      {
        id: 4,
        title: "设备信息",
        image: "https://img.99666666.xyz/yugang/images/introduce/设备信息.jpg",
        loaded: false
      },
      {
        id: 5,
        title: "编组",
        image: "https://img.99666666.xyz/yugang/images/introduce/编组.jpg",
        loaded: false
      },
      {
        id: 6,
        title: "淡海水首页",
        image: "https://img.99666666.xyz/yugang/images/introduce/淡海水首页.jpg",
        loaded: false
      },
      {
        id: 7,
        title: "温度设置",
        image: "https://img.99666666.xyz/yugang/images/introduce/温度设置.jpg",
        loaded: false
      },
      {
        id: 8,
        title: "临时开关",
        image: "https://img.99666666.xyz/yugang/images/introduce/临时开关.jpg",
        loaded: false
      },
      {
        id: 9,
        title: "OTA升级",
        image: "https://img.99666666.xyz/yugang/images/introduce/OTA升级.jpg",
        loaded: false
      },
      {
        id: 10,
        title: "配置数据",
        image: "https://img.99666666.xyz/yugang/images/introduce/配置数据.jpg",
        loaded: false
      },
      {
        id: 11,
        title: "通道配置-海水DIY设备专用",
        image: "https://img.99666666.xyz/yugang/images/introduce/通道配置.jpg",
        loaded: false
      },
      {
        id: 12,
        title: "快捷模式",
        image: "https://img.99666666.xyz/yugang/images/introduce/快捷模式.jpg",
        loaded: false
      },
      {
        id: 13,
        title: "玩家模式",
        image: "https://img.99666666.xyz/yugang/images/introduce/玩家模式.jpg",
        loaded: false
      },
      {
        id: 14,
        title: "高阶模式",
        image: "https://img.99666666.xyz/yugang/images/introduce/高阶模式.jpg",
        loaded: false
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  // 图片加载成功回调
  onImageLoad(e) {
    const index = e.currentTarget.dataset.index;
    this.setData({
      [`mixedList[${index}].loaded`]: true
    });
  },

  // 图片加载失败处理
  onImageError(e) {
    const index = e.currentTarget.dataset.index;
    console.error(`图片加载失败: ${this.data.mixedList[index].image}`);
    // 可选：替换为错误占位图
    /*this.setData({
      [`mixedList[${index}].image`]: '/images/error-placeholder.jpg'
    });*/
  },

  copyOldDoc() {
    const $t = this
    wx.setClipboardData({
      data: 'https://pan.baidu.com/s/14Ur97-BtZd3PjDI-lQzfHg?pwd=znkt',
      success(res) {
        wx.hideToast();
        $t.showToast("下载链接已复制到剪贴板，请粘贴到浏览器中打开下载！");
      },
      fail() {
        $t.showToast("复制到剪贴板失败!");
      }
    })
  },
  showToast(msg) {
    wx.showToast({
      title: msg,
      icon: 'none',
      duration: 3000
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },
})